﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for BasePage
/// </summary>
public class BasePage : System.Web.UI.Page
{
    public BasePage() {
        this.PreRender += new EventHandler(Page_PreRender);
        this.PreInit += new EventHandler(Page_PreInit);
    }
    private void Page_PreInit(object sender, EventArgs e)
    {
        var preferredTheme = Request.Cookies.Get("PreferredTheme");
        if (preferredTheme != null)
        {
            Page.Theme = preferredTheme.Value;
        }
    }
    private void Page_PreRender(object sender, EventArgs e)
    {
        if (this.Title == "Untitled Page" || String.IsNullOrEmpty(this.Title))
        {
            throw new Exception("Title is blank!!!");
        }
    }

}